<template>
	<view class="content">
		<view @click="toChoose" class="head f-c-b themeColor f30">
			<text>头像</text>
			<image class="headImg" :src="vuex_user.img" mode=""></image>
		</view>

		<view @click="$to('../edit-name/edit-name')" class="name f-c-b themeColor f30">
			<text>昵称</text>
			<view class="f-c">
				<text class="name-n f30">{{vuex_user.name}}</text>
				<image class="arrow-right" src="../../static/my/icon_gd.png" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import uploadImg from '../../utils/uploadImg/index.js'
	export default {
		data() {
			return {
				baseURL: this.$u.baseUrl,
			}
		},

		methods: {
			async toChoose() {
				const res = await uploadImg(this.$u.api.fileUpLoad, 1)
				console.log(res[0]);
				const res1=await this.$u.api.updateImg({
					id:this.vuex_user.id,
					img:res[0]
				})
				console.log(res1);
				this.vuex_user.img=this.baseURL+res[0]
			}
		}
	}
</script>

<style>
	.content {
		padding: 40rpx;
	}

	.headImg {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
	}

	.head,
	.name {
		padding-bottom: 15rpx;
		margin-bottom: 40rpx;
		border-bottom: 1rpx solid #373737;
	}

	.arrow-right {
		width: 18rpx;
		margin: 0 15rpx;
	}

	.name-n {
		color: #747474;
	}
</style>
